# Author    : CoffeeChicken
# Date      : 2020-12-02 20:17
# Function  : 演示 分析json

import json
import requests

json_url = "https://www.iesdouyin.com/web/api/v2/aweme/post/?sec_uid=MS4wLjABAAAAGZkW5n1EHZD_TFyQ-QiaISBPemtKFxVVdhLSeo" \
           "Xhh-U&count=200"
# &max_cursor=0&aid=1129&_signature=f0FvMgAAIIgMt2VdPKZcqX9Bby&dytk=
headers = {
    'User-Agent': 'Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko)'
                  ' Chrome/66.0.3329.0 Mobile Safari/537.36'
}

for _ in range(100):

    result = requests.get(json_url, headers)
    json_str = result.text
    json_type = json.loads(json_str)
    length = len(json_type["aweme_list"])
    if length != 0:
        # for item in json_type["aweme_list"]:
        #     video_url = item["video"]["play_addr"]["url_list"][0]
        #     print(video_url)
        print(length)
        # print(json_type["aweme_list"])
